

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>Create Employee</title>         
    </head>
    <body>
        <div class="body">
            <h1>Create Employee</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${employeeInstance}">
            <div class="errors">
                <g:renderErrors bean="${employeeInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form action="save" method="post" >
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="firstName">First Name:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'firstName','errors')}">
                                    <input type="text" id="firstName" maxLength="20" onchange="javascript:password.value=this.value.substring(0,3)+lastName.value.substring(0,3);passwordVerify.value=password.value;" name="firstName" value="${fieldValue(bean:employeeInstance,field:'firstName')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="lastName">Last Name:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'lastName','errors')}">
                                    <input type="text" id="lastName" maxLength="20" onchange="javascript:password.value=firstName.value.substring(0,3)+this.value.substring(0,3);passwordVerify.value=password.value;" name="lastName" value="${fieldValue(bean:employeeInstance,field:'lastName')}"/>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="dob">Date of birth:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'dob','errors')}">
                                    <g:datePicker name="dob" value="${employeeInstance?.dob}" precision="day" ></g:datePicker>
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="street">Street:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'street','errors')}">
                                    <input type="text" id="street" maxLength="20" name="street" value="${fieldValue(bean:employeeInstance,field:'street')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="city">City:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'city','errors')}">
                                    <input type="text" id="city" maxLength="20" name="city" value="${fieldValue(bean:employeeInstance,field:'city')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="zipCode">Zip Code:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'zipCode','errors')}">
                                    <input maxlength="6" size="6" type="text" id="zipCode" name="zipCode" value="${fieldValue(bean:employeeInstance,field:'zipCode')}" />
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="email">Email:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'email','errors')}">
                                    <input type="text" id="email" maxLength="50" name="email" value="${fieldValue(bean:employeeInstance,field:'email')}"/>
                                </td>
                            </tr>

                            <tr class="prop">
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="userName">User Name:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'userName','errors')}">
                                    <input type="text" id="userName" maxLength="10" name="userName" value="${fieldValue(bean:employeeInstance,field:'userName')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="password">Password:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'password','errors')}">
                                  <input type="text" id="password" maxLength="50" name="password" value="${fieldValue(bean:employeeInstance,field:'password')}"/>
                                    
                                </td>
                            </tr>

                            <tr class="prop">
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="admin">Access rights:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'admin','errors')}">
                                  <select id="isAdmin" name="isAdmin">
                                    <option value="True">Admin</option>
                                    <option selected value="False">Employee</option>
                                  </select>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="title">Title:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'title','errors')}">
                                    <input type="text" id="title" maxlength="20" name="title" value="${fieldValue(bean:employeeInstance,field:'title')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="salary">Salary:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'salary','errors')}">
                                    <input type="text" id="salary" maxlength="8" size="8" name="salary" value="${fieldValue(bean:employeeInstance,field:'salary')}" /> (SEK)
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="percentageWork">Percentage Work:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'percentageWork','errors')}">
                                    <input type="text" size="5" maxlength="5" id="percentageWork" name="percentageWork" value="${fieldValue(bean:employeeInstance,field:'percentageWork')}" />%
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="employeeId">Employee Id:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'employeeId','errors')}">
                                    <input type="text" id="employeeId" name="employeeId" value="${fieldValue(bean:employeeInstance,field:'employeeId')}" />
                                </td>
                            </tr> 
                        </tbody>
                    </table>
                </div>
              <br>
                <div class="buttons">
                    <span class="button"><input class="save" type="submit" value="Create" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
